ServerRoot "/etc/httpd"
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>
<Directory "/var/www/html">
    Options  FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8

<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf

{% if RUCIO_HTTPD_ENABLE_STATUS|default('False') == 'True' %}
LoadModule status_module modules/mod_status.so
ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost
</Location>
{% endif %}

Timeout {{ RUCIO_HTTPD_TIMEOUT | default('60') }}

{% if RUCIO_HTTPD_MPM_MODE is defined and RUCIO_HTTPD_MPM_MODE == "prefork" -%}
StartServers           {{ RUCIO_HTTPD_START_SERVERS | default('8') }}
MinSpareServers        {{ RUCIO_HTTPD_MIN_SPARE_SERVERS | default('5') }}
MaxSpareServers        {{ RUCIO_HTTPD_MAX_SPARE_SERVERS | default('20') }}
ServerLimit            {{ RUCIO_HTTPD_SERVER_LIMIT | default('256') }}
MaxClients             {{ RUCIO_HTTPD_MAX_CLIENTS | default('256') }}
MaxRequestsPerChild    {{ RUCIO_HTTPD_MAX_REQUESTS_PER_CHILD | default('4000') }}
{% elif RUCIO_HTTPD_MPM_MODE is defined and RUCIO_HTTPD_MPM_MODE == "worker" -%}
StartServers           {{ RUCIO_HTTPD_START_SERVERS | default('1') }}
MaxClients             {{ RUCIO_HTTPD_MAX_CLIENTS | default('20') }}
MinSpareThreads        {{ RUCIO_HTTPD_MIN_SPARE_THREADS | default('1') }}
MaxSpareThreads        {{ RUCIO_HTTPD_MAX_SPARE_THREADS | default('20') }}
ThreadsPerChild        {{ RUCIO_HTTPD_THREADS_PER_CHILD | default('5') }}
MaxRequestsPerChild    {{ RUCIO_HTTPD_MAX_REQUESTS_PER_CHILD | default('8192') }}
{% else %}
KeepAlive              {{ RUCIO_HTTPD_KEEP_ALIVE | default('On') }}
KeepAliveTimeout       {{ RUCIO_HTTPD_KEEP_ALIVE_TIMEOUT | default('5') }}
MaxKeepAliveRequests   {{ RUCIO_HTTPD_MAX_KEEP_ALIVE_REQUESTS | default('128') }}
ServerLimit            {{ RUCIO_HTTPD_SERVER_LIMIT | default('10') }}
StartServers           {{ RUCIO_HTTPD_START_SERVERS | default('4') }}
ThreadLimit            {{ RUCIO_HTTPD_THREADS_LIMIT | default('128') }}
ThreadsPerChild        {{ RUCIO_HTTPD_THREADS_PER_CHILD | default('128') }}
MinSpareThreads        {{ RUCIO_HTTPD_MIN_SPARE_THREADS | default('256') }}
MaxSpareThreads        {{ RUCIO_HTTPD_MAX_SPARE_THREADS | default('512') }}
MaxRequestWorkers      {{ RUCIO_HTTPD_MAX_REQUEST_WORKERS | default('1280') }}
MaxConnectionsPerChild {{ RUCIO_HTTPD_MAX_CONNECTIONS_PER_CHILD | default('2048') }}
{% endif %}
